ALTER TABLE Supporter DROP CONSTRAINT levelCheck;

CREATE OR REPLACE FUNCTION checkLevel(i integer) RETURNS boolean as $$
 BEGIN
   RETURN i BETWEEN 0 AND 5;
 END;
$$ LANGUAGE plpgsql;

ALTER TABLE Supporter ADD CONSTRAINT levelCheck CHECK (checkLevel(Level));
